//package com.faner.fast.manager.redis;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.listener.PatternTopic;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//import org.springframework.data.redis.listener.Topic;
//
//@Configuration
//public class MessageListenerConfiguration {
//
//    @Value("${spring.redis.listen-pattern}")
//    private String pattern;
//
//    @Bean
//    public RedisMessageListenerContainer listenerContainer(RedisConnectionFactory redisConnectionFactory){
//        //初始化RedisListenerContainer 并和redis建立连接
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(redisConnectionFactory);
//        // 添加监听器 设置监听主题
//        Topic topic = new PatternTopic(this.pattern);
//        container.addMessageListener(new TopicMessageListener(), topic);
//
//        return container;
//    }
//}
